textbuffer: Do not unset selection if failing to update the primary selection
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 2 Jul 2014 13:28:45 +0000 (15:28 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 2 Jul 2014 16:57:39 +0000 (18:57 +0200)
This is expected to happen on wayland and other platforms with no primary selection,
and just leads to the selected text being cleared after any attempt to change the
text selection itself through either mouse/keyboard.

gtk/gtktextbuffer.c

index 6a03b55f2a3367143a569bc4539327b5fc4568d1..10d41d4d6c8458ff6be4824b43089a9316bb2757 100644 (file)
@@ -3656,13 +3656,12 @@ update_selection_clipboards (GtkTextBuffer *buffer)
          /* Even if we already have the selection, we need to update our
           * timestamp.
           */
-         if (!gtk_clipboard_set_with_owner (clipboard,
-                                             priv->copy_target_entries,
-                                             priv->n_copy_target_entries,
-                                            clipboard_get_selection_cb,
-                                            clipboard_clear_selection_cb,
-                                            G_OBJECT (buffer)))
-           clipboard_clear_selection_cb (clipboard, buffer);
+          gtk_clipboard_set_with_owner (clipboard,
+                                        priv->copy_target_entries,
+                                        priv->n_copy_target_entries,
+                                        clipboard_get_selection_cb,
+                                        clipboard_clear_selection_cb,
+                                        G_OBJECT (buffer));
        }
 
       tmp_list = tmp_list->next;